
<template>
  <div class="scientificPart">
    <div class="top">
   
      <span @click="back"><van-icon   name="arrow-left"></van-icon> 返回</span>
      <span>{{ title }}</span
      ><span style="width: 42px"></span>
    </div>

    <router-view></router-view>
    <!-- <div
      class="bottomList"
      v-if="$route.name == 'sindex' || $route.name == 'sMine'"
    >
      <ul>
        <li>
          <router-link to="./sindex"
            ><img
              v-if="index"
              src="@/assets/images/scientific/icon-home-pick.png"
              alt=""
            /><img
              v-else
              src="@/assets/images/scientific/icon-home.png"
              alt=""
            />
            <span>首页</span></router-link
          >
        </li>
        <li>
          <router-link to="./sMine"
            ><img
              v-if="index"
              src="@/assets/images/scientific/icon-my.png"
              alt=""
            /><img
              v-else
              src="@/assets/images/scientific/icon-my-pick.png"
              alt=""
            />
            <span>我的</span></router-link
          >
        </li>
      </ul>
    </div> -->
    <!-- <van-tabbar
      v-model="active"
      @change="tabChange"
      route
      active-color="#4775d9"
       v-if="$route.name == 'sindex' || $route.name == 'dMine'"
    >
      <van-tabbar-item replace to="./sindex" icon="apps-o"
        >首页</van-tabbar-item
      >

      <van-tabbar-item replace to="./dMine" icon="contact"
        >个人中心</van-tabbar-item
      >
    </van-tabbar> -->

  </div>
</template>

<script>
import { mapGetters } from "vuex";
import { getStorage } from "@/utils/auth";
export default {
  name: "index",
  components: {},
  data() {
    return {
      active: 0,
      index: true,
      title: "",
    };
  },
  mounted() {
    this.$route.name == "sindex" ? (this.index = true) : (this.index = false);
    this.title = this.$route.meta.title;
  },
  computed: {
    ...mapGetters(["userData"]),
  },
  watch: {
    $route(to, from) {
      this.title = this.$route.meta.title;
    },
  },
  methods: {
    back() {
      // this.$router.replace({ path: "/" });
      this.$router.go(-1)
    },

    tabChange(i) {
      this.$store.commit("list/SET_BACK_STATUS", null);
    },
  },
  created() {
    // console.log(JSON.parse(this.userData),11)
    let lang = getStorage("lang");
    this.$i18n.locale = lang ? lang : "cn";
  },

  destroyed() {},
};
</script>
<style lang='scss' scoped>
.scientificPart {
  background: #f4f6f8;
}

.top {
  background: -webkit-linear-gradient(top, #3751ff, #909fff);
  /* Safari 5.1 - 6.0 */
  background: -o-linear-gradient(bottom, #3751ff, #909fff);
  /* Opera 11.1 - 12.0 */
  background: -moz-linear-gradient(bottom, #3751ff, #909fff);
  /* Firefox 3.6 - 15 */
  background: linear-gradient(to bottom, #3751ff, #909fff);
  color: #fff;
  padding: 15px 0.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  span{
    font-size: 14px;
    display: flex;
    align-items: center;
  }
}
.back {
  transform: rotate(180deg);
  width: 0.15rem;
}
.bottomList {
}
.bottomList ul {
  position: fixed;
  display: flex;
  justify-content: space-around;
  width: 100%;
  background: #fff;
  bottom: 0;
  padding: 5px 0;
}
.bottomList li {
  width: 50%;
  text-align: center;
}
.bottomList li a {
  display: block;
}
.bottomList li a span {
  display: block;
  font-size: 10px;
}
.bottomList li img {
  width: 27px;
  display: block;
  text-align: center;
  margin: 0 auto;
}
</style>